package com.tledu.collection;

import java.util.TreeMap;

public class Map02 {
    public static void main(String[] args) {
        TreeMap<Student,String> studentTreeMap = new TreeMap<>();

        studentTreeMap.put(new Student(101, "李逵"), "黑旋风");
        studentTreeMap.put(new Student(87, "宋江"), "宋江");
        studentTreeMap.put(new Student(123, "鲁智深"), "鲁智深");

        for (Student student : studentTreeMap.keySet()) {
            System.out.println(student.getStuNum());
        }
//        1. 会按照key进行排序
        //2. key需要是一个可比较的引用类型，需要实现Comparable接口

    }
}
